Sound processors produce sound by controlling digital data, which is transformed into a voltage by means of a digital-to-analog converter (DAC). This voltage is used to drive a speaker system to create sound. Sound processors that are wave-table-based use sound data from memory as a source and modify that sound by: altering the pitch; controlling the volume over time; transforming the sound through the use of filters; and employing other effects.
Polyphonic sound processors create multiple sounds simultaneously by creating independent sound streams and adding them together. Each separate sound that can be played simultaneously is referred to as a voice, and each voice has its own set of control parameters.
FIG. 1 is a block diagram of a conventional sound system 50. The sound system 50 includes a main processor 52, a memory controller 54, an external memory 56, a sound processor chip 58, a DAC 60, and a speaker system 62. The sound processor chip 58 includes a voice engine 70, which includes a 2D voice engine (2DVE) 72 and a 3D voice engine (3DVE) 74, a prefetch module 76, which includes arbitration logic 78, and a sound data buffer 80.
In operation, generally, the main processor 52 reads from and writes to the sound processor 58, and the memory controller 54 fetches sound data from the external memory 56 and sends the sound data to the sound processor 58. The sound processor 58 outputs processed sound data to the DAC 60. The DAC 60 converts the sound data from digital to analog and then sends the sound data to the speaker system 62.
The 3D voices require about three times the amount of processing as the 2D voices, and both of the 2DVE 72 and the 3DVE 74 operate concurrently. Each voice engine 72 and 74 has a control register that can limit the number of voices to be less than the maximum number. This voice limitation is done for power-saving or cost-saving reasons.
Generally, the sound generated by a sound processor may be processed in frames of sound data, each frame including a fixed number of sound samples, all for a given voice. Frame-based processing is more efficient than processing a voice at a time, because switching voices involves fetching all of the associated control parameters and history of the new voice. A sound processor that does frame-based processing fetches the number of sound samples from memory that is required to generate the number of sound samples in a frame. A problem with fetching sound data from memory is that the sound processor wastes cycles waiting for the sound data to become available.
One conventional solution that aims to make the most efficient use of the sound processor involves prefetching sound data for a voice. In a typical implementation, the prefetch module 76 has the responsibility of prefetching data for the 2DVE 72 and the 3DVE 74.
A problem with this conventional solution is that it has a die size and performance penalty due to the additional hardware required to implement the prefetch module. For instance, the prefetch module 76 requires the arbitration logic 78 to interface with and to monitor the 2DVE 72 and 3DVE 74. The arbitration logic 78 also must monitor the memory controller 54 and the sound data buffers 80. For example, when a given voice engine 72 or 74 requires sound data, the arbitration logic 78 determines which voice engine 72 and/or 74 needs the sound data so that the prefetch module 76 can make memory requests to prefetch the sound data. The arbitration logic 78 then determines which of the buffers 80 are available to store the prefetched sound data. The arbitration logic 78 keeps track of which buffers 80 contain the prefetched sound data so that the prefetch module 76 can send the prefetched sound data to the appropriate voice engine 72 or 74 when needed.
Also, when the memory controller 54 is able to handle another memory request and a sound data buffer 80 is available, the prefetch module 76 makes the memory request to prefetch sound data for the next voice. In addition, the prefetch module 76 must account for the limitation on the number of voices in its prefetching algorithm. Also, when sound data from a memory request has not arrived in time for a voice because of excessive memory/system latency, the prefetch module 76 must tell the requesting voice engine 72 and/or 74 not to process the sound data, and prefetch module 76 must decide how to recover from the error.
Accordingly, what is needed is a more efficient system and method for prefetching sound data in a sound processing system. The system and method should be simple, cost effective and capable of being easily adapted to existing technology. The present invention addresses such a need.